﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;

public class CreateAssetBundles : MonoBehaviour
{
    static string dir = "AssetBundles";

    //生成不压缩的AB包
    [MenuItem("Assets/BuildUnCompressedAssetBundles")]
    static void BuildUnCompressedAssetBundles()
    {
        if (Directory.Exists(dir) == false)
            Directory.CreateDirectory(dir);
        BuildPipeline.BuildAssetBundles(dir, BuildAssetBundleOptions.UncompressedAssetBundle, BuildTarget.StandaloneWindows64);
    }

    //生成LZMA格式的AB包
    [MenuItem("Assets/BuildLZMAAssetBundle")]
    static void BuildLZMAAssetBundle()
    {
        if (Directory.Exists(dir) == false)
            Directory.CreateDirectory(dir);
        BuildPipeline.BuildAssetBundles(dir, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);
    }

    //生成LZ4格式的AB包
    [MenuItem("Assets/BuildLZ4AssetBundle")]
    static void BuildLZ4AssetBundle()
    {
        if (Directory.Exists(dir) == false)
            Directory.CreateDirectory(dir);
        BuildPipeline.BuildAssetBundles(dir, BuildAssetBundleOptions.ChunkBasedCompression, BuildTarget.StandaloneWindows64);
    }
}
